import * as types from '../actionTypes/counter';

// 干活了
export const counter = (state = 0, action) => {
  console.log('counter==>', state, action);
  // 增加
  if (action.type === types.INCREMENT) {
    return state + action.payload;
  }

  // 减少
  if (action.type === types.DECREMENT) {
    return state - action.payload;
  }

  return state;
};
